import { createRouter, createWebHistory } from 'vue-router';
import Index from '../views/Index.vue';
import Center from '../views/center/Center.vue';

// 导入路由

const routes = [
    {
        path: '/',
        name: 'index',
        component: Index,
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import('../views/Login.vue'), // 懒加载 用到才加载
    },
    {
        path: '/register',
        name: 'Register',
        component: () => import('../views/Register.vue'),
    },
    {
        path: '/center',
        name: 'Center',
        component: Center,
    },
    {
        path: '/knowledge',
        name: 'Knowledge',
        component: () => import('../views/knowledge/Knowledge.vue'),
    },{
        path:'/messagecenter',
        name:'Messagecenter',
        component:()=>import('../views/chat/MessageCenter.vue')
    },
    {
        path: '/:pathMatch(.*)*', //设置通配符
        name: 'NotFound',
        component: () => import('../views/notFound/NotFound404.vue'),
    },
];
const router = createRouter({
    history: createWebHistory(),
    routes,
});

// 遍历路由,当有子路由的时才需要添加子路由

export default router;
